package com.sunwayworld.baseline;

import java.util.function.Function;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;

import com.sunwayworld.GikamCoreApplication;
import com.sunwayworld.framework.spring.SunwayApplication;
import com.sunwayworld.framework.spring.annotation.SunwayBootApplication;

@ComponentScan(basePackages={"com.sunwayworld"})
@SunwayBootApplication
@SpringBootApplication
public class GikamLimsMsApplication extends GikamCoreApplication {
    public static void main(String[] args) {
        SunwayApplication.run(GikamLimsMsApplication.class, args);
    }

    @Override
    public Function<HttpSecurity, HttpSecurity> securityConfigureCustomizer() {
        return r -> {
            try {
                r.authorizeRequests().antMatchers(new String[]{
                        "/core/module/item/files/**"}).authenticated();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            return r;
        };
    }
}
